home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Screens / ResizeWorm.s < prev    next >
Text File  |  1997-12-16  |  7KB  |  293 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Picture Resize
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This version of the Worm demo opens a 640x512 screen and resizes the 320x256
  7. ;background to fit this screen mode.  Then it blits the worm on top, which
  8. ;appears at half its normal size because of the change of resolution.
  9. ;
  10. ;You can change the resolution if you like, just edit the settings below.
  11.  
  12. SCREENWIDTH   =    640    ;Factor of 16
  13. SCREENHEIGHT  =    512
  14. SCREENMODE    =    HIRES|LACED
  15. SCREENCOLOURS =    32
  16.  
  17.     INCDIR    "GMSDev:Includes/"
  18.     INCLUDE    "dpkernel/dpkernel.i"
  19.  
  20.     SECTION    "Demo",CODE
  21.  
  22. ;===========================================================================;
  23. ;                             INITIALISE DEMO
  24. ;===========================================================================;
  25.  
  26.     STARTDPK
  27.  
  28. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  29.     move.l    DPKBase(pc),a6
  30.     lea    ScreenTags(pc),a0
  31.     sub.l    a1,a1
  32.     CALL    Init
  33.     tst.l    d0
  34.     beq    .Exit
  35.  
  36. ;---------------------------------------------------------------------------;
  37. ;Load a picture into the background of the screen.  We have to set the
  38. ;correct palette and copy it to our second buffer as part of this process.
  39.  
  40.     move.l    Screen(pc),a1
  41.     lea    PIC_BackgroundTags(pc),a0
  42.     move.l    GS_MemPtr1(a1),Data
  43.     CALL    Init
  44.     tst.l    d0
  45.     beq    .Exit
  46.  
  47.     move.l    SCRBase(pc),a6
  48.     move.l    Screen(pc),a0
  49.     move.l    PIC_Background(pc),a1
  50.     move.l    PIC_Palette(a1),GS_Palette(a0)
  51.     CALL    scrUpdatePalette
  52.  
  53.     move.l    BLTBase(pc),a6
  54.     move.l    Screen(pc),a0
  55.     moveq    #BUFFER1,d0
  56.     moveq    #BUFFER2,d1
  57.     CALL    bltCopyBuffer
  58.  
  59. ;---------------------------------------------------------------------------;
  60. ;Initialise the restore object.
  61.  
  62.     move.l    DPKBase(pc),a6
  63.     lea    RestoreTags(pc),a0
  64.     move.l    Screen(pc),a1    ;a1 = Screen.
  65.     move.l    GS_Bitmap(a1),RBitmap    ;ma = Bitmap for restore list.
  66.     CALL    Init    ;>> = Initialise the restore list.
  67.     tst.l    d0    ;d0 = Check for errors.
  68.     beq.s    .Exit    ;>> = Error, exit.
  69.  
  70. ;---------------------------------------------------------------------------;
  71. ;Load the bob file in.  This contains the graphics data that we are going to
  72. ;draw to the screen.
  73.  
  74.     lea    BBT_Rambo(pc),a0
  75.     move.l    Screen(pc),a1
  76.     CALL    Init
  77.     tst.l    d0
  78.     beq.s    .Exit
  79.  
  80.     lea    SMT_Rambo(pc),a0
  81.     sub.l    a1,a1
  82.     CALL    Init
  83.     tst.l    d0
  84.     beq.s    .Exit
  85.  
  86.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  87.     CALL    Get
  88.     move.l    d0,JoyData
  89.     beq.s    .Exit
  90.     move.l    d0,a0    ;Initialise the joydata structure.
  91.     sub.l    a1,a1
  92.     CALL    Init
  93.     tst.l    d0
  94.     beq.s    .Exit
  95.  
  96.     move.l    Screen(pc),a0
  97.     CALL    Display
  98.  
  99.     bsr.s    Main
  100.  
  101. .Exit    move.l    DPKBase(pc),a6
  102.     move.l    JoyData(pc),a0
  103.     CALL    Free
  104.     move.l    SND_Rambo(pc),a0
  105.     CALL    Free
  106.     move.l    BOB_Rambo(pc),a0
  107.     CALL    Free
  108.     move.l    Restore(pc),a0
  109.     CALL    Free
  110.     move.l    PIC_Background(pc),a0
  111.     CALL    Free
  112.     move.l    Screen(pc),a0
  113.     CALL    Free
  114.     MOVEM.L    (SP)+,A0-A6/D1-D7
  115.     moveq    #ERR_OK,d0
  116.     rts
  117.  
  118. ;===========================================================================;
  119. ;                                MAIN LOOP
  120. ;===========================================================================;
  121.  
  122. SPEED    =    5
  123. FIRESPEED =    0
  124.  
  125. Main:    moveq    #$00,d7
  126.  
  127. .Loop    move.l    DPKBase(pc),a6
  128.     move.l    Restore(pc),a0
  129.     CALL    Activate
  130.  
  131.     move.l    BOB_Rambo(pc),a0
  132.     CALL    Draw    ;Blit the bob.
  133.  
  134.     move.l    SCRBase(pc),a6
  135.     CALL    scrWaitAVBL
  136.  
  137.     move.l    Screen(pc),a0
  138.     CALL    scrSwapBuffers
  139.  
  140.     addq.w    #1,d7
  141.  
  142.     move.l    DPKBase(pc),a6
  143.     move.l    BOB_Rambo(pc),a1
  144.     tst.b    FireState
  145.     bne.s    .FireOn
  146.  
  147.     cmp.w    #SPEED,d7
  148.     ble.s    .Move
  149.     moveq    #$00,d7
  150.     addq.w    #1,BOB_Frame(a1)
  151.     cmp.w    #9,BOB_Frame(a1)
  152.     blt.s    .Move
  153.     clr.w    BOB_Frame(a1)
  154.     bra.s    .Move
  155.  
  156. .FireOn    cmp.w    #FIRESPEED,d7
  157.     ble.s    .Move
  158.     moveq    #$00,d7
  159.     cmp.w    #10,BOB_Frame(a1)
  160.     bge.s    .On
  161.     move.w    #9,BOB_Frame(a1)
  162.  
  163. .On    addq.w    #1,BOB_Frame(a1)
  164.     cmp.w    #13,BOB_Frame(a1)
  165.     blt.s    .Move
  166.     clr.w    BOB_Frame(a1)
  167.     clr.b    FireState
  168.     move.l    SND_Rambo(pc),a0
  169.     CALL    Activate
  170.  
  171. .Move    move.l    JoyData(pc),a0
  172.     CALL    Query
  173.     move.l    JoyData(pc),a0
  174.     move.l    BOB_Rambo(pc),a1
  175.     move.w    JD_XChange(a0),d0
  176.     add.w    d0,BOB_XCoord(a1)
  177.     move.w    JD_YChange(a0),d0
  178.     add.w    d0,BOB_YCoord(a1)
  179.     move.l    JD_Buttons(a0),d0
  180.     btst    #JB_LMB,d0
  181.     beq.s    .chkRMB
  182.     st    FireState    ;Set fire to on.
  183. .chkRMB    btst    #JB_RMB,d0
  184.     beq    .Loop
  185.     rts
  186.  
  187. FireState:
  188.     dc.b    0
  189.     even
  190.  
  191. ;===========================================================================;
  192. ;                                  DATA
  193. ;===========================================================================;
  194.  
  195. JoyData:    dc.l  0
  196.  
  197. ;---------------------------------------------------------------------------;
  198.  
  199. RestoreTags:    dc.l  TAGS_RESTORE
  200. Restore:    dc.l  0
  201.         dc.l  RSA_Owner
  202. RBitmap:    dc.l  0
  203.         dc.l  RSA_Entries,1
  204.         dc.l  RSA_Buffers,2
  205.         dc.l  TAGEND
  206.  
  207. ;---------------------------------------------------------------------------;
  208.  
  209. ScreenTags:    dc.l  TAGS_SCREEN
  210. Screen:        dc.l  0
  211.         dc.l  GSA_Width,SCREENWIDTH
  212.         dc.l  GSA_Height,SCREENHEIGHT
  213.         dc.l    GSA_BitmapTags,0
  214.         dc.l    BMA_AmtColours,SCREENCOLOURS
  215.         dc.l    TAGEND,0
  216.         dc.l  GSA_Attrib,DBLBUFFER|CENTRE
  217.         dc.l  GSA_ScrMode,SCREENMODE
  218.         dc.l  TAGEND
  219.  
  220. ;---------------------------------------------------------------------------;
  221.  
  222. PIC_BackgroundTags:
  223.         dc.l  TAGS_PICTURE
  224. PIC_Background:    dc.l  0
  225.         dc.l    PCA_BitmapTags,0
  226.         dc.l    BMA_Data
  227. Data:        dc.l    0
  228.         dc.l    BMA_Width,SCREENWIDTH
  229.         dc.l    BMA_Height,SCREENHEIGHT
  230.         dc.l    BMA_AmtColours,SCREENCOLOURS
  231.         dc.l    TAGEND,0
  232.         dc.l  PCA_ScrMode,SCREENMODE
  233.         dc.l  PCA_Options,IMG_RESIZE
  234.         dc.l  PCA_Source,.file
  235.         dc.l  TAGEND
  236.  
  237. .file        FILENAME "GMS:demos/data/PIC.Green"
  238.  
  239. ;---------------------------------------------------------------------------;
  240.  
  241. BBT_Rambo:    dc.l  TAGS_BOB
  242. BOB_Rambo:    dc.l  0
  243.         dc.l  BBA_GfxCoords,.frames
  244.         dc.l  BBA_Width,32
  245.         dc.l  BBA_Height,24
  246.         dc.l  BBA_XCoord,50
  247.         dc.l  BBA_YCoord,50
  248.         dc.l  BBA_Attrib,BBF_GENMASKS|BBF_CLIP|BBF_RESTORE
  249.         dc.l    BBA_SourceTags,ID_PICTURE
  250.         dc.l      PCA_BitmapTags,0
  251.         dc.l      BMA_MemType,MEM_BLIT
  252.         dc.l      TAGEND,0
  253.         dc.l    PCA_Source,.file
  254.         dc.l    TAGEND,0
  255.         dc.l  TAGEND
  256.  
  257. .frames        dc.w    0,00 ;X/Y Graphic
  258.         dc.w   32,00 ;...
  259.         dc.w   64,00
  260.         dc.w   96,00
  261.         dc.w  128,00
  262.         dc.w  160,00
  263.         dc.w  192,00
  264.         dc.w  224,00
  265.         dc.w  256,00
  266.         dc.w  288,00
  267.         dc.w    0,48
  268.         dc.w   32,48
  269.         dc.w   64,48
  270.         dc.l  -1
  271.  
  272. .file        FILENAME "GMS:demos/data/PIC.Rambo"
  273.  
  274. ;---------------------------------------------------------------------------;
  275.  
  276. SMT_Rambo:    dc.l  TAGS_SOUND
  277. SND_Rambo:    dc.l  0
  278.         dc.l  SA_Octave,OCT_C2S
  279.         dc.l  SA_Volume,100
  280.         dc.l  SA_Source,.file
  281.         dc.l  TAGEND
  282.  
  283. .file        FILENAME "GMS:demos/data/SND.Rambo"
  284.  
  285. ;===========================================================================;
  286.  
  287. ProgName:    dc.b  "Resize Worm",0
  288. ProgAuthor:    dc.b  "Paul Manias",0
  289. ProgDate:    dc.b  "10 December 1997",0
  290. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  291. ProgShort:    dc.b  "Resizing demonstration.",0
  292.         even
  293.